package com.jun.flower.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jun.flower.bean.TbAdministrator;
import com.jun.flower.bean.TbAdministratorExample;
import com.jun.flower.bean.TbAdministratorExample.Criteria;
import com.jun.flower.dao.TbAdministratorMapper;
import com.jun.flower.service.AdministratorService;

@Service
public class AdministratorServiceImpl implements AdministratorService {
	@Autowired
	private TbAdministratorMapper administratorMapper;
	
	@Override
	public boolean loginAdministrator(String administratorname, String password) {
		TbAdministratorExample example = new TbAdministratorExample();
		Criteria criteria = example.createCriteria();
		criteria.andAdministratornameEqualTo(administratorname);
		criteria.andPasswordEqualTo(password);
		List<TbAdministrator> list = administratorMapper.selectByExample(example);
		if (list == null || list.size() == 0) {
			// 如果没有查询到数据返回false
			return false;
		}
		// 如果查询到数据返回true
		return true;
	}

}
